#pragma once

//-----------------------------------------------------
// Include Files
//-----------------------------------------------------
#include "StdAfx.h"
#include "d3dUtil.h"
#include "Transformer.h"
#include "RenderContext.h"
#include "ContentManager.h"

#include <vector>
//Class forward declaration
class InputState;
class RenderContext;
class LevelElement;
class PhysX;
class NxScene;
class GraphCamera;
//-----------------------------------------------------
// Level Class									
//-----------------------------------------------------
class Level
{
public:

	Level(ID3D10Device *pD3DDevice, PhysX* physx);				// Constructor
	virtual ~Level();		// Destructor

	/*************************************************************************
	* Returns the Device pointer
	* It retrieves pose from physx engine and uses it to render
	*/
	ID3D10Device *GetDevice(){return m_pD3DDevice;}


	/*************************************************************************
	* New: Adds a child object
	* @param newGraphElement element to add to the level
	*/
	void AddChild(LevelElement *newGraphElement);

	/**
	* Removes a child object
	* @param child element : the child element to remove
	*/
	void RemoveChild(LevelElement *childElement);

	/*************************************************************************
	* Calls all child objects Initialize method.
	*/
	virtual void Initialize(ContentManager *pContentManager, GraphCamera* graphcamera);

	/*************************************************************************
	* Calls all child objects Tick method
	* @param refInputState to use.
	*/
	virtual void Tick(const InputState & refInputState);

	/*************************************************************************
	* Calls all child objects Draw method
	* @param RenderContext to use.
	*/
	virtual void Draw(const RenderContext* pRenderContext, ID3D10ShaderResourceView* shadowdepthmap) ;
	virtual void DrawShadowMap(GraphCamera* pOrtohCam, D3DXMATRIX &mLightVolume
		,ID3D10Effect* BuildShadowMapFX);
	/*************************************************************************
	* Calls all child objects OnResize method
	* @param RenderContext to use.
	*/
	virtual void OnResize(int clientWidth, int clientHeight);
	NxScene *GetPhysicsScene() const ;
	PhysX* GetPhysX() { return m_pPhysX; }

protected:
	/*************************************************************************
	* All nodes in this graph use same D3DDevice
	*/
	ID3D10Device *m_pD3DDevice;


private:
	//-------------------------------------------------
	// Datamembers								
	//-------------------------------------------------
	vector<LevelElement*>m_Nodes;
	PhysX* m_pPhysX;
	GraphCamera* m_GraphCamera;
	// -------------------------
	// Disabling default copy constructor and default 
	// assignment operator.
	// -------------------------
	Level(const Level& yRef);									
	Level& operator=(const Level& yRef);	
};

 
